package com.cxf.windex.rest.minab;

import com.cxf.windex.base.constant.UserConstant;
import com.cxf.windex.base.msg.TableResultResponse;
import com.cxf.windex.base.rest.BaseRestController;
import com.cxf.windex.biz.BOrdersTaskBiz;
import com.cxf.windex.biz.BResourcesBiz;
import com.cxf.windex.entity.BOrdersTask;
import com.cxf.windex.entity.BResouces;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @program: business_needs
 * @description: 订单任务类
 * @author: chenxf
 * @create: 2018-11-13 11:54
 **/
@Api(tags = {"村广通[小程序-商] - 订单任务接口"})
@Controller
@RequestMapping("userb/ordersTask")
public class BOrderTaskController extends BaseRestController<BOrdersTaskBiz,BOrdersTask> {
    @ApiOperation(value = "查询订单任务", notes = "查询订单任务")
@ApiImplicitParams({
    @ApiImplicitParam(name = "limit", value = "记录数 默认10", required = false, paramType = "query", dataType = "int"),
    @ApiImplicitParam(name = "offset", value = "页码 默认 1", required = false, paramType = "query", dataType = "int"),
    @ApiImplicitParam(name = "orderStr", value = "排序 默认desc", required = false, paramType = "query", dataType = "String"),
    @ApiImplicitParam(name = "resourcesId", value = "资源ID", required = false, paramType = "query", dataType = "String"),
    @ApiImplicitParam(name = "orderId", value = "订单ID", required = false, paramType = "query", dataType = "String"),
})
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public TableResultResponse<BOrdersTask> list(
    @RequestParam(defaultValue = "10") int limit, @RequestParam(defaultValue = "1") int offset,
    @RequestParam(defaultValue = "desc") String orderStr,  String resourcesName,String resourcesId,String orderId) {
  List<BOrdersTask> items = baseBiz.reviewList(limit, offset, orderStr, resourcesId,orderId);
  PageInfo<BOrdersTask> pageInfo = new PageInfo<>(items);
  return new TableResultResponse<BOrdersTask>(Integer.parseInt(String.valueOf(pageInfo.getTotal())),
      offset, limit,
      items);
}

}
